package com.gome.test2.mvnopi;

import java.rmi.RemoteException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.axis2.AxisFault;
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;

import com.gome.test2.mvnopi.BC_TEST_SI_TEST_Out_AsyStub.DT_TEST_Req;
import com.gome.test2.mvnopi.BC_TEST_SI_TEST_Out_AsyStub.MT_TEST_Req;
import com.gome.test2.mvnopi.BC_TEST_SI_TEST_Out_AsyStub.TEST001_type0;

public class Test {
	private static final String USERNAME = "jingxuan";
	private static final String PASSWORD = "Abc1234";

	public static void main(String[] args) {
//		callWebService();
	}

	public static void callWebService() {
		try {
			HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
			authenticator.setUsername(USERNAME);
			authenticator.setPassword(PASSWORD);
			
			BC_TEST_SI_TEST_Out_AsyStub s = new BC_TEST_SI_TEST_Out_AsyStub();
			Options opt = s._getServiceClient().getOptions();
			opt.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(10000));
			opt.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
			
			MT_TEST_Req m = new MT_TEST_Req();
			DT_TEST_Req d = new DT_TEST_Req();
			TEST001_type0 t = new TEST001_type0();
			Date date = new Date();
			DateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
			String a = df.format(date);
			t.setA(a);
			d.addTEST001(t);
			m.setMT_TEST_Req(d);
			s.sI_TEST_Out_Asy(m);
		} catch (AxisFault e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
